/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.impl;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import net.easoftware.code.beans.MICreditPopUpReport;
import net.easoftware.code.beans.MICreditRowDetail;
import net.easoftware.code.dao.ReporteDao;
import net.easoftware.code.error.EaError;

/**
 *
 * @author Eliu
 */
@SessionScoped
@Named
public class PopUpChequesRechaImpl extends MICreditPopUpReport implements Serializable {

    private List<ChequeRechazadoRow> cheques = new LinkedList<>();
    @Inject
    ReporteDao reportesDao;

    public List<ChequeRechazadoRow> getCheques() {
        return cheques;
    }

    @Override
    public void update(MICreditRowDetail row) {
        this.setPage("module/popups/chequesrechazados.xhtml");
        this.cheques = new LinkedList<>();
        if (row != null) {
            try {
                this.cheques = reportesDao.getChequesRechazados(row.getAnio(), row.getMes(),
                        row.getLineaNegocio(), row.getUnidadNegocio());
            }
            catch (EaError ex) {
                Logger.getLogger(PopUpChequesRechaImpl.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
